/**
 * Created by liumin on 14-8-21.
 */
if(typeof (module) !="undefined"){
    module.exports = FEffectParser; //


    var FEffectBase = require('./FEffectBase');
    var FColorBase = require('./FColorBase');
    var FColor = require('./FColor');
    var FGradient = require('./FGradient');
    var FPattern = require('./FPattern');
    var FStylizeBase = require('./FStylizeBase');
    var FStylizeShadow = require('./FStylizeShadow');
    var FGraphBase = require('./FGraphBase');
    var FStroke = require('./FStroke');
    var FFilterBase = require('./FFilterBase');
    var FImageFilter = require('./FImageFilter');
}



function FEffectParser(){

}



// 从一个未知json对象中，解析出对应Obj(在文档初始化的时候使用)
FEffectParser.prototype.fromUnknownJson =  function (colorObj, versionId){



    var ret = null;
    switch(colorObj.type){

        case FEffectBase.prototype.TYPE_EFFECT_BASE:
            ret = new FEffectBase();
            break;
        case FEffectBase.prototype.TYPE_COLOR_BASE:
            ret = new FColorBase();
            break;
        case FEffectBase.prototype.TYPE_COLOR:
            ret = new FColor();
            break;
        case FEffectBase.prototype.TYPE_GRADIENT:
            ret = new FGradient();
            break;
        case FEffectBase.prototype.TYPE_PATTERN:
            ret = new FPattern();
            break;
        case FEffectBase.prototype.TYPE_STYLIZE_BASE:
            ret = new FStylizeBase();
            break;
        case FEffectBase.prototype.TYPE_STYLIZE_SHADOW:
            ret = new FStylizeShadow();
            break;
        case FEffectBase.prototype.TYPE_GRAPH_BASE:
            ret = new FGraphBase();
            break;
        case FEffectBase.prototype.TYPE_STROKE:
            ret = new FStroke();
            break;
        case FEffectBase.prototype.TYPE_FILTER_BASE:
            ret = new FFilterBase();
            break;
        case FEffectBase.prototype.TYPE_IMAGE_FILTER:
            ret = new FImageFilter();
            break;
        default:
            break;
    }
    ret.fromJson(colorObj,versionId);
    return ret;
}
